package com.magenta.maxoptra.gis;

import static com.magenta.maxoptra.gis.GisParameter.*;


/**
 * User: KuznetsovD
 * Date: 25.10.11
 * Time: 16:14
 */
public enum Map24Attribute implements GISAccountProperty {
    UseProvider(GisParameter.use_map_provider, MapProviderType.map24,GISFieldType.BOOLEAN, "false", true, 0L, true),
    Map24Key(map_key, MapProviderType.map24, GISFieldType.TEXT, "FJXa45d9c6116c83d4dc91ebfa662575X35", true, 1L, true),
    Map24Url(base_url, MapProviderType.map24, GISFieldType.TEXT, "http://api.maptp.map24.com/ajax", true, 2L, true),
    Map24ID(map_id, MapProviderType.map24, GISFieldType.TEXT, "http://api.maptp.map24.com/ajax", true, 3L, true),
    Map24Region(region, MapProviderType.map24, GISFieldType.TEXT, "Europe", true, 4L, true),
    Map24UseMapKey(use_map_key, MapProviderType.map24, GISFieldType.BOOLEAN, "true", true, 5L, true),
    Map24UseCustomGeoAddressForm(use_custom_geo_address_form, MapProviderType.map24, GISFieldType.BOOLEAN, "false", true, 6L, true),
    Map24UseShortestRoute(use_shortest_route, MapProviderType.map24, GISFieldType.BOOLEAN, "true", false, 7L, true),
    Map24EnableLog(enableLogging, MapProviderType.map24, GISFieldType.BOOLEAN, "false", false, 8L, true),
    Map24EnableCache(enableCache, MapProviderType.map24, GISFieldType.BOOLEAN, "true", true, 10L, true),
    Map24CacheStorageTime(cacheStorageTime, MapProviderType.map24, GISFieldType.INTEGER, "30", true, 11L, true),
    Map24UseMultiplePointsRouting(useMultiplePointsRouting, MapProviderType.map24, GISFieldType.BOOLEAN, "false", false, 9L, true);

    private String name;
    private String label;
    private Long order;
    private GISFieldType type;
    private String defaultValue;
    private boolean required;
    private String groupName;
    private String tab = "GIS";
    private boolean important = true;

    public boolean isImportant() {
        return important;
    }

    public String getName() {
        return name;
    }

    public GISFieldType getType() {
        return type;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public Boolean getMandatory() {
        return required;
    }

    public String getGroup() {
        return groupName;
    }

    public String getLabel() {
        return label;
    }

    public Long getOrder() {
        return order;
    }

    public String getTab() {
        return tab;
    }

    private Map24Attribute(String name, String label, GISFieldType type, String defaultValue,
                           boolean required, String groupName, Long order, boolean important) {
        this.name = name;
        this.label = label;
        this.type = type;
        this.defaultValue = defaultValue;
        this.groupName = groupName;
        this.required = required;
        this.order = order;
        this.important = important;
    }

    private Map24Attribute(GisParameter parameter, MapProviderType providerType, GISFieldType type,
                           String defaultValue, boolean required, Long order, boolean important) {
        this(parameter.withProvider(providerType.name()),
                parameter.getLabel(),
                type,
                defaultValue,
                required,
                providerType.getLabel(),
                order,important);
    }

    public boolean isReadOnly() {
        return false;
    }

}
